﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>GuiCtrlFromHwnd - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The GuiCtrlFromHwnd function retrieves the GuiControl object of a GUI control associated with the specified HWND." />
<meta name="ahk:equiv-v1" content="commands/Gui.htm" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css">
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>GuiCtrlFromHwnd</h1>

<p>检索与指定的 HWND 关联的 GUI 控件的 <a href="../objects/GuiControl.htm">GuiControl 对象</a>.</p>
<pre class="Syntax">GuiControlObj := <span class="func">GuiCtrlFromHwnd</span>(Hwnd)</pre>

<h2 id="Parameters">参数</h2>
<dl>
  <dt>Hwnd</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#numbers">整数</a></p>
    <p>GUI 控件的窗口句柄(HWND). 可以使用 <a href="../objects/Gui.htm#Add">Gui.Add</a> 创建这样的控件.</p>
  </dd>
</dl>
  
<h2 id="Return_Value">Return Value</h2>
<p>类型: <a href="../Concepts.htm#objects">对象</a></p>
<p>函数返回对现有 <a href="../objects/GuiControl.htm">GuiControl 对象</a>的<a href="../Concepts.htm#references-to-objects">引用</a>. 该对象提供了用于修改 GUI 控件和检索有关控件的信息的方法和属性.</p>

<h2 id="Remarks">备注</h2>
<p>例如, 能通过 <a href="../objects/GuiControl.htm#Hwnd">GuiCtrl.Hwnd</a>, <a href="MouseGetPos.htm">MouseGetPos</a> 或 <a href="OnMessage.htm">OnMessage</a> 来检索 GUI 控件的 HWND.</p>

<h2 id="Related">相关</h2>
<p><a href="../objects/Gui.htm#New">Gui.New</a>, <a href="../objects/Gui.htm">Gui 对象</a>, <a href="../objects/GuiControl.htm">GuiControl 对象</a>, <a href="GuiFromHwnd.htm">GuiFromHwnd</a>, <a href="GuiControls.htm">控件类型</a>, <a href="ListView.htm">ListView</a>, <a href="TreeView.htm">TreeView</a>, <a href="../objects/Menu.htm">Menu 对象</a>, <a href="Control.htm">控件函数</a>, <a href="MsgBox.htm">MsgBox</a>, <a href="FileSelect.htm">FileSelect</a>, <a href="DirSelect.htm">DirSelect</a></p>

<h2 id="Examples">示例</h2>
<p>请参阅 Gui 对象页面上的 <a href="../objects/Gui.htm#ExToolTip">ToolTip 示例</a>.<br></p>
</body>
</html>